package com.micro.ai.models.entity;

import com.baomidou.mybatisplus.annotation.*;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime;

/**
 * 模型配置实体类
 * 
 * @author micro-ai
 * @since 0.0.1
 */
@Data
@TableName("model_configs")
@Schema(description = "模型配置信息")
public class ModelConfig implements Serializable {

    private static final long serialVersionUID = 1L;

    /**
     * 主键ID
     */
    @TableId(value = "id", type = IdType.ASSIGN_ID)
    @Schema(description = "配置ID", example = "config_123456789")
    private String id;

    /**
     * 租户ID
     */
    @Schema(description = "租户ID", example = "tenant_001")
    private String tenantId;

    /**
     * 模型ID
     */
    @Schema(description = "模型ID", example = "model_123")
    private String modelId;

    /**
     * 配置名称
     */
    @Schema(description = "配置名称", example = "默认配置")
    private String configName;

    /**
     * 加密的API密钥
     */
    @Schema(description = "加密的API密钥", example = "sk-***")
    private String apiKeyEncrypted;

    /**
     * API基础URL
     */
    @Schema(description = "API基础URL", example = "https://api.openai.com/v1")
    private String apiBaseUrl;

    /**
     * 每分钟速率限制
     */
    @Schema(description = "每分钟速率限制（请求次数）", example = "60")
    private Integer rateLimitPerMinute;

    /**
     * 超时时间（毫秒）
     */
    @Schema(description = "超时时间（毫秒）", example = "30000")
    private Integer timeoutMs;

    /**
     * 最大重试次数
     */
    @Schema(description = "最大重试次数", example = "3")
    private Integer maxRetries;

    /**
     * 默认温度
     */
    @Schema(description = "默认温度（0-2）", example = "0.7")
    private BigDecimal defaultTemperature;

    /**
     * 默认最大token数
     */
    @Schema(description = "默认最大token数", example = "2048")
    private Integer defaultMaxTokens;

    /**
     * 每1k输入token成本
     */
    @Schema(description = "每1k输入token成本（美元）", example = "0.03")
    private BigDecimal costPer1kInput;

    /**
     * 每1k输出token成本
     */
    @Schema(description = "每1k输出token成本（美元）", example = "0.06")
    private BigDecimal costPer1kOutput;

    /**
     * 是否为默认配置
     */
    @Schema(description = "是否为默认配置", example = "true")
    private Boolean isDefault;

    /**
     * 状态：active-活跃, inactive-停用
     */
    @Schema(description = "状态（active-活跃，inactive-停用）", example = "active", allowableValues = {"active", "inactive"})
    private String status;

    /**
     * 创建人ID
     */
    @Schema(description = "创建人ID", example = "1001")
    private String createdBy;

    /**
     * 创建时间
     */
    @TableField(fill = FieldFill.INSERT)
    @Schema(description = "创建时间", example = "2025-01-01 00:00:00")
    private LocalDateTime createdAt;

    /**
     * 更新时间
     */
    @TableField(fill = FieldFill.INSERT_UPDATE)
    @Schema(description = "更新时间", example = "2025-01-01 00:00:00")
    private LocalDateTime updatedAt;
}
